/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ca.trader.beans.java;

import ca.trader.beans.enterprise.SaleBean;
import ca.trader.beans.enterprise.SaleBeanLocal;
import ca.trader.beans.enterprise.UserBean;
import ca.trader.beans.enterprise.UserBeanLocal;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author Ahsan
 */
public class BeanUtils
{	 
	 /**
	  *
	  * @return the user bean
	  */
	 protected static UserBeanLocal getUserBean() throws NamingException
	 {
		  // Get the initial context
		  InitialContext ic = new InitialContext();

		  // Get the UserBEan object
		  return (UserBeanLocal) ic.lookup("java:global/TraderMaven/" + UserBean.class.getSimpleName());
	 }

	 /**
	  *
	  * @return the sale bean
	  */
	 protected static SaleBeanLocal getSaleBean() throws NamingException
	 {
		  // Get the initial context
		  InitialContext ic = new InitialContext();

		  // Get the UserBEan object
		  return (SaleBeanLocal) ic.lookup("java:global/TraderMaven/" + SaleBean.class.getSimpleName());
	 }
}
